//
//  MyBankCardCell.m
//  MRBang
//
//  Created by 铅笔 on 16/4/20.
//  Copyright © 2016年 杭州易网新科技. All rights reserved.
//

#import "MyBankCardCell.h"


@interface MyBankCardCell ()

@property (nonatomic,strong) UIView *view_topBG;
@property (nonatomic,strong) UIImageView *imageView_icon;
@property (nonatomic,strong) UILabel *label_bankName;//银行名
@property (nonatomic,strong) UILabel *label_detailText;//详细小字
@property (nonatomic,strong) UILabel *label_status;//状态

@property (nonatomic,strong) UIButton *button_right;//右侧按钮

@end


@implementation MyBankCardCell

- (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initWithCardRecordCellSubviews];
    }
    return self;
}

- (void) initWithCardRecordCellSubviews
{
    
    // 头部
    self.view_topBG = [[UIView alloc] initWithFrame:CGRectMake(10*PROPORTION_WIDTH, 16*PROPORTION_WIDTH, kScreenWidth-10*2*PROPORTION_WIDTH, 160*PROPORTION_WIDTH)];
    [self addSubview:self.view_topBG];
    self.view_topBG.layer.cornerRadius = 3.0;
    self.view_topBG.clipsToBounds = YES;
    
    //imageview
    self.imageView_icon = [[UIImageView alloc] initWithFrame:CGRectMake(48*PROPORTION_WIDTH, 10, 100*PROPORTION_WIDTH, 100*PROPORTION_WIDTH)];
    [self.view_topBG addSubview:self.imageView_icon];
    self.imageView_icon.layer.cornerRadius = 5.0;
    self.imageView_icon.clipsToBounds = YES;
    
    //银行名
    self.label_bankName = [[UILabel alloc] initWithFrame:CGRectMake(self.imageView_icon.frame.size.width+self.imageView_icon.frame.origin.x+10, self.imageView_icon.frame.origin.y+5, kScreenWidth-self.imageView_icon.frame.size.width-self.imageView_icon.frame.origin.x-80, 20)];
    [self.view_topBG addSubview:self.self.label_bankName];
    self.label_bankName.font = [UIFont systemFontOfSize:24*PROPORTION_WIDTH];
//    self.label_bankName.textColor = [BaseViewController colorWithHexString:@"#010101"];
    self.label_bankName.textColor = [UIColor whiteColor];
    
    //detail
    self.label_detailText = [[UILabel alloc] initWithFrame:CGRectMake(self.label_bankName.frame.origin.x, self.label_bankName.frame.origin.y+self.label_bankName.frame.size.height, self.label_bankName.frame.size.width, 30)];
    [self.view_topBG addSubview:self.self.label_detailText];
    self.label_detailText.font = [UIFont systemFontOfSize:18*PROPORTION_WIDTH];
//    self.label_detailText.textColor = [BaseViewController colorWithHexString:@"#666666"];
    self.label_detailText.textColor = [UIColor whiteColor];
    
    //uilabel
    self.label_status =  [[UILabel alloc] initWithFrame:CGRectMake(kScreenWidth-130*PROPORTION_WIDTH, self.label_bankName.frame.origin.y+self.label_bankName.frame.size.height-8, 130*PROPORTION_WIDTH,20*2*PROPORTION_WIDTH)];
    [self.view_topBG addSubview:self.label_status];
    self.label_status.font = [UIFont systemFontOfSize:14.67*2*PROPORTION_WIDTH];
    
    //按钮
//        self.button_right = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth-70, self.view_topBG.frame.size.height/2-25,44*2*PROPORTION_WIDTH, 30*2*PROPORTION_WIDTH)];
//        [self.view_topBG addSubview:self.button_right];
//        [self.button_right setBackgroundColor:RXDColor(255, 118, 112)];
//        [self.button_right setTitle:@"激活" forState:UIControlStateNormal];
//        [self.button_right.titleLabel setFont:[UIFont systemFontOfSize:14.67*2*PROPORTION_WIDTH]];
//        self.button_right.layer.cornerRadius = 3.0;
//        self.button_right.clipsToBounds = YES;
//    
//     [self.button_right addTarget:self action:@selector(deleteDataAction) forControlEvents:UIControlEventTouchUpInside];
    
}

//- (void) layoutSubviews
//{
//    self.imageView_icon.image = [UIImage imageNamed:@"b_bcms"];
//    self.label_bankName.text = @"中国淘宝网联名信用卡";
//    self.label_detailText.text = @"匹配淘宝Vip等级,尊享Vip权益";
    
    //    self.label_status.textColor = [BaseViewController colorWithHexString:@"#ff7670"];
    //    self.label_status.text = @"正在审核";
    //    self.label_status.textColor = [BaseViewController colorWithHexString:@"#b3b3b3"];
    //    self.label_status.text = @"已激活";
    //    self.label_status.textColor = [BaseViewController colorWithHexString:@"#010101"];
    //    self.label_status.text = @"已放卡";
    
//}

- (void) initWithCarRecordModel:(MyBankCardModel *)modelValue
{

    if ([modelValue.bankname containsString:@"农业"]) {
        self.imageView_icon.image = [UIImage imageNamed:@"nongye"];
        self.view_topBG.backgroundColor = [BaseViewController colorWithHexString:@"#12baa5"];

    }
    if ([modelValue.bankname containsString:@"中国银行"]) {
        self.imageView_icon.image = [UIImage imageNamed:@"china"];
        self.view_topBG.backgroundColor = [BaseViewController colorWithHexString:@"#ec6671"];
        
    }
    if ([modelValue.bankname containsString:@"建设"]) {
        self.imageView_icon.image = [UIImage imageNamed:@"jianshe"];
        self.view_topBG.backgroundColor = [BaseViewController colorWithHexString:@"#236cc1"];
        
    }
    if ([modelValue.bankname containsString:@"邮政"]) {
        self.imageView_icon.image = [UIImage imageNamed:@"youzheng"];
        self.view_topBG.backgroundColor = [BaseViewController colorWithHexString:@"#1eb068"];
        
    }
    if ([modelValue.bankname containsString:@"中信"]) {
        self.imageView_icon.image = [UIImage imageNamed:@"zhongxin"];
        self.view_topBG.backgroundColor = [BaseViewController colorWithHexString:@"#ec6671"];
        
    }
    if ([modelValue.bankname containsString:@"光大"]) {
        self.imageView_icon.image = [UIImage imageNamed:@"guangda"];
        self.view_topBG.backgroundColor = [BaseViewController colorWithHexString:@"#e54ba0"];
        
    }
    if ([modelValue.bankname containsString:@"兴业"]) {
        self.imageView_icon.image = [UIImage imageNamed:@"xingye"];
        self.view_topBG.backgroundColor = [BaseViewController colorWithHexString:@"#236cc1"];
        
    }
    if ([modelValue.bankname containsString:@"工商"]) {
        self.imageView_icon.image = [UIImage imageNamed:@"gongshang"];
        self.view_topBG.backgroundColor = [BaseViewController colorWithHexString:@"#ec6671"];
    }
    if ([modelValue.bankname containsString:@"招商"]) {
        self.imageView_icon.image = [UIImage imageNamed:@"zhaoshang"];
        self.view_topBG.backgroundColor = [BaseViewController colorWithHexString:@"#ec6671"];
    }
    if ([modelValue.bankname containsString:@"交通"]) {
        self.imageView_icon.image = [UIImage imageNamed:@"jiaotong"];
        self.view_topBG.backgroundColor = [BaseViewController colorWithHexString:@"#236cc1"];
    }
//    if ([modelValue.bankname containsString:@"华夏"]) {
//        self.imageView_icon.image = [UIImage imageNamed:@"huaxia"];
//        self.view_topBG.backgroundColor = [BaseViewController colorWithHexString:@"#ec6671"];
//    }
//    if ([modelValue.bankname containsString:@"深圳发展"]) {
//        self.imageView_icon.image = [UIImage imageNamed:@"shenfa"];
//        self.view_topBG.backgroundColor = [BaseViewController colorWithHexString:@"#40b4ec"];
//    }
//    if ([modelValue.bankname containsString:@"民生"]) {
//        self.imageView_icon.image = [UIImage imageNamed:@"minsheng"];
//        self.view_topBG.backgroundColor = [BaseViewController colorWithHexString:@"#40b4ec"];
//    }
//    if ([modelValue.bankname containsString:@"平安"]) {
//        self.imageView_icon.image = [UIImage imageNamed:@"pingan"];
//        self.view_topBG.backgroundColor = [BaseViewController colorWithHexString:@"#fc7f39"];
//    }

    self.label_bankName.text = modelValue.bankname;
    self.label_detailText.text = modelValue.banknum;
}

- (void)awakeFromNib {
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    
}

@end
